<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        <form action="">
        账号：<input type="text" v-model="user"><br><br>
        密码：<input type="password" v-model="pwd"><br><br>
        <button @click.prevent="loginhander">登录</button>
        </form>
    </div>

    <script>
        var vm1 = new Vue({
            el:"#app",
            
            data:{
                user:"",
                pwd:"",
            },
            
            methods:{
                loginhander(){
                    if(this.user.length<3 || this.pwd.length<3){
                        // 长度太短不能登录
                        alert("长度太短不能登录");
                    }else{
                        // 页面跳转
                        location.assign("http://www.baidu.com")
                    }
                }
            }
        })
    </script>

</body>
</html>